/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.manager;

import br.com.foxline.model.NatureWriting;
import br.com.foxline.service.NatureWritingService;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
 
/**
 *
 * @author roniere
 */
@ManagedBean
@ViewScoped
public class ManagerNatureWriting implements Serializable{
    
    @EJB
    private NatureWritingService natureWritingService;
    
    private NatureWriting natureWriting;

    public ManagerNatureWriting() {
         System.err.println("CONSC");
    }
    
    @PostConstruct
    public void init(){
         System.err.println("INIT");
        natureWriting = new NatureWriting();
    }

    public NatureWriting getNatureWriting() {
        return natureWriting;
    }

    public void setNatureWriting(NatureWriting natureWriting) {
        this.natureWriting = natureWriting;
    }
    
    public void create(){
       natureWritingService.saveNatureWriting(natureWriting);
        natureWriting = new NatureWriting();
        
    }
    public List<NatureWriting> autocomplete(String query){
        return natureWritingService.autoComplete(query);
    }
    
}
